﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.ExtJs421Demo.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="Js/jquery-1.8.3.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {
            $("#btnInsert").click(function() {
                $.ajax({
                    type: "POST",
                    contentType: "application/json",
                    url: "Service/xmlWebService.asmx/InsertXml",
                    data: "{}",
                    dataType: 'json',
                    async: false,
                    success: function(result) {
                        alert("调用成功");
                    },
                    error: function(error) {
                        alert("调用出错：" + error.responseText);
                    }
                })
            });


            $("#btnSelect").click(function() {
                $.ajax({
                    type: "POST",
                    contentType: "application/json",
                    url: "Service/xmlWebService.asmx/SelectXml",
                    data: "{Id:'" + $("#tbxProperty").val() + "'}",
                    dataType: 'json',
                    async: false,
                    success: function(result) {
                        alert("调用成功");
                    },
                    error: function(error) {
                        alert("调用出错：" + error.responseText);
                    }
                })
            });


        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnInsert" runat="server" Text="Insert" />
    </div>
    <div>
        <asp:TextBox ID="tbxProperty" runat="server" Text=""></asp:TextBox>
        <asp:Button ID="btnSelect" runat="server" Text="Select" />
    </div>
    </form>
</body>
</html>
